# -*- coding: utf-8 -*-
"""
 ----------------------------------------
|File Name:     handlePdf
|Author:        WYT
|date:          2021/6/2
 ----------------------------------------
|  Change Activity:
|                   2021/6/2:
-----------------------------------------
"""
import os
import time

from base.BaseMethod import BM
from util.g import g
from util.pdfSplit.compress_pdf import CompressPdf
from util.pdfSplit.pdf_split import get_file_oss

pdf_list = ["hzdata-cc:1184932021/0sta1184932021400747.pdf","hzdata-cc:1184932021/0sta1184932021400748.pdf","hzdata-cc:1184932021/0sta1184932021400749.pdf","hzdata-cc:1184932021/0sta1184932021400750.pdf","hzdata-cc:1184932021/0sta1184932021400751.pdf","hzdata-cc:1184932021/0sta1184932021400752.pdf","hzdata-cc:1184932021/0sta1184932021400753.pdf","hzdata-cc:1184932021/0sta1184932021400754.pdf","hzdata-cc:1184932021/0sta1184932021400755.pdf","hzdata-cc:1184932021/0sta1184932021400756.pdf","hzdata-cc:1184932021/0sta1184932021400757.pdf","hzdata-cc:1184932021/0sta1184932021400758.pdf","hzdata-cc:1184932021/0sta1184932021400759.pdf","hzdata-cc:1184932021/0sta1184932021400760.pdf","hzdata-cc:1184932021/0sta1184932021400761.pdf","hzdata-cc:1184932021/0sta1184932021400762.pdf","hzdata-cc:1184932021/0sta1184932021400763.pdf","hzdata-cc:1184932021/0sta1184932021400764.pdf","hzdata-cc:1184932021/0sta1184932021400765.pdf","hzdata-cc:1184932021/0sta1184932021400766.pdf","hzdata-cc:1184932021/0sta1184932021400767.pdf","hzdata-cc:1184932021/0sta1184932021400768.pdf"]


g.co_id = 118493
g.year = 2021

for i, path in enumerate(pdf_list):
    ma_path = BM.get_material_path()
    file_path = ma_path + "\\STA"
    if not os.path.exists(file_path):
        os.makedirs(file_path)
    print(i + 1)
    file_path += "\\{}.pdf.pdf".format(i + 1)

    # get_file_oss(oss_path=path, local_path=file_path)

    CompressPdf(file_path=file_path, max_size=2).compress()
